<?php

class MyAppModel extends AppModel {
    //自动使用Cache _WithCache
    function __call ( $name , $arguments ) {
        if (strstr($name, '_WithCache')) {
            $key = md5(get_class().'_'.$name.'_'.json_encode($arguments));
            if ($ret = Cache::read($key)) {
                return $ret;
            }
            $real_name = str_replace('_WithCache', '', $name);
            $ret = call_user_method_array($real_name, $this, $arguments);
            Cache::write($key, $ret);
            return $ret;
        }
    }
}